﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using XDL.Framework.Weapons;
using XDL.Framework;
using JumpNFight.Simulation;

namespace JumpNFight.Weapons
{
    class TeleportWeaponSystem :
        GameComponent,
        IWeapon
    {
        World m_world;
        AudioManager m_audio;

        public const int TeleportEventID = 9001;

        public TeleportWeaponSystem(Game game) :
            base(game)
        {
        }

        public override void Initialize()
        {
            Settings = Game.Content.Load<WeaponSettings>("Weapons/Teleport");
            m_world = GameServices.GetService<World>();
            m_audio = GameServices.GetService<AudioManager>();
        }

        public WeaponSettings Settings
        {
            get;
            private set;
        }

        public void Fire(int ownerID, Vector3 position, Vector3 direction)
        {
            m_audio.PlayCue("Teleport/Fire");
            GameServices.EventDispatcher.PostEvent(m_world.ID, TeleportWeaponSystem.TeleportEventID, new TeleportEventArgs(ownerID));
        }
    }
}
